#include "app_trace.h"
#include "display_drv.h"
#include "lcd_extra.h"
#include "nrf_delay.h"
#define LOG(fmt, ...) app_trace_log(fmt "\r\n", ##__VA_ARGS__)
#if 1
#define LCD_GC9203_DataWrite(value)         \
    oled_write_data(((value) >> 8) & 0xFF); \
    oled_write_data((value)&0xFF);
#define LCD_GC9203_CtrlWrite(value)        \
    oled_write_cmd(((value) >> 8) & 0xFF); \
    oled_write_cmd((value)&0xFF);
#else
#define LCD_GC9203_DataWrite(value) \
    oled_write_data((value)&0xFF);  \
    oled_write_data(((value) >> 8) & 0xFF);
#define LCD_GC9203_CtrlWrite(value) \
    oled_write_cmd((value)&0xFF);   \
    oled_write_cmd(((value) >> 8) & 0xFF);
#endif
void lcd_extra_config(void)
{
    //     peripheral_oledpower_On();
    //     LCD_GC9203_CtrlWrite(0x00ff);
    //     LCD_GC9203_DataWrite(0x5aa5);

    //     LCD_GC9203_CtrlWrite(0x00f6);
    //     LCD_GC9203_DataWrite(0x0112);

    //     LCD_GC9203_CtrlWrite(0x00ef);
    //     LCD_GC9203_DataWrite(0x1052);

    //     LCD_GC9203_CtrlWrite(0x00a5);
    //     LCD_GC9203_DataWrite(0x0780);

    //     LCD_GC9203_CtrlWrite(0x0002);
    //     LCD_GC9203_DataWrite(0x0100);

    //     LCD_GC9203_CtrlWrite(0x0003);
    //     LCD_GC9203_DataWrite(0x1030);

    //     LCD_GC9203_CtrlWrite(0x0001);
    //     LCD_GC9203_DataWrite(0x011c);

    //     LCD_GC9203_CtrlWrite(0x0010);
    //     LCD_GC9203_DataWrite(0x0000);

    //     LCD_GC9203_CtrlWrite(0x0011);
    //     LCD_GC9203_DataWrite(0x1000);

    //     LCD_GC9203_CtrlWrite(0x0020);
    //     LCD_GC9203_DataWrite(0x0000);

    //     LCD_GC9203_CtrlWrite(0x0021);
    //     LCD_GC9203_DataWrite(0x0000);

    //     LCD_GC9203_CtrlWrite(0x0030);
    //     LCD_GC9203_DataWrite(0x0000);

    //     LCD_GC9203_CtrlWrite(0x0031);
    //     LCD_GC9203_DataWrite(0x00DB);

    //     LCD_GC9203_CtrlWrite(0x0032);
    //     LCD_GC9203_DataWrite(0x0000);

    //     LCD_GC9203_CtrlWrite(0x0033);
    //     LCD_GC9203_DataWrite(0x0000);

    //     LCD_GC9203_CtrlWrite(0x0034);
    //     LCD_GC9203_DataWrite(0x00DB);

    //     LCD_GC9203_CtrlWrite(0x0035);
    //     LCD_GC9203_DataWrite(0x0000);

    //     // LCD_GC9203_CtrlWrite(0x0036);
    //     // LCD_GC9203_DataWrite(0x0097);

    //     // LCD_GC9203_CtrlWrite(0x0037);
    //     // LCD_GC9203_DataWrite(0x0018);

    //     // LCD_GC9203_CtrlWrite(0x0038);
    //     // LCD_GC9203_DataWrite(0x00DB);

    //     // LCD_GC9203_CtrlWrite(0x0039);
    //     // LCD_GC9203_DataWrite(0x0000);

    //     LCD_GC9203_CtrlWrite(0x0050);
    //     LCD_GC9203_DataWrite(0xf980);

    //     LCD_GC9203_CtrlWrite(0x0051);
    //     LCD_GC9203_DataWrite(0x2218);

    //     LCD_GC9203_CtrlWrite(0x0052);
    //     LCD_GC9203_DataWrite(0x0609);

    //     LCD_GC9203_CtrlWrite(0x0053);
    //     LCD_GC9203_DataWrite(0x3b04);

    //     LCD_GC9203_CtrlWrite(0x0054);
    //     LCD_GC9203_DataWrite(0x4c1b);

    //     LCD_GC9203_CtrlWrite(0x0055);
    //     LCD_GC9203_DataWrite(0x1b10);

    //     LCD_GC9203_CtrlWrite(0x0056);
    //     LCD_GC9203_DataWrite(0x3f2e);

    //     LCD_GC9203_CtrlWrite(0x0057);
    //     LCD_GC9203_DataWrite(0xf580);

    //     LCD_GC9203_CtrlWrite(0x0058);
    //     LCD_GC9203_DataWrite(0x2218);

    //     LCD_GC9203_CtrlWrite(0x0059);
    //     LCD_GC9203_DataWrite(0x0613);

    //     LCD_GC9203_CtrlWrite(0x005A);
    //     LCD_GC9203_DataWrite(0x4704);

    //     LCD_GC9203_CtrlWrite(0x005B);
    //     LCD_GC9203_DataWrite(0x601b);

    //     LCD_GC9203_CtrlWrite(0x005C);
    //     LCD_GC9203_DataWrite(0x0f01);

    //     LCD_GC9203_CtrlWrite(0x005D);
    //     LCD_GC9203_DataWrite(0x3f2e);

    //     LCD_GC9203_CtrlWrite(0x000f);
    //     LCD_GC9203_DataWrite(0x0901);

    //     LCD_GC9203_CtrlWrite(0x00eb);
    //     LCD_GC9203_DataWrite(0x041f);

    //     LCD_GC9203_CtrlWrite(0x00ec);
    //     LCD_GC9203_DataWrite(0x0a3c);

    //     LCD_GC9203_CtrlWrite(0x00E8);
    //     LCD_GC9203_DataWrite(0x0000);

    //     LCD_GC9203_CtrlWrite(0x00Ed);
    //     LCD_GC9203_DataWrite(0x3008);

    //     LCD_GC9203_CtrlWrite(0x0007);
    //     LCD_GC9203_DataWrite(0x1013);

    //     LCD_GC9203_CtrlWrite(0x00fe);

    //     // LCD_GC9203_CtrlWrite(0x002a);
    //     // LCD_GC9203_DataWrite(0x0000);
    //     // LCD_GC9203_DataWrite(OLED_SIZE_X);
    //     // LCD_GC9203_DataWrite(0x0000);
    //     // LCD_GC9203_DataWrite(OLED_SIZE_Y);
    //     LCD_GC9203_CtrlWrite(0x0022);

    //     for (int i = 0; i < OLED_SIZE_X; i++)
    //     {
    //         for (int j = 0; j < OLED_SIZE_Y / 2; j++)
    //         {
    //             oled_write_data(0x00);
    //             oled_write_data(0x00);

    //         }
    //     }
    //     for (int i = 0; i < OLED_SIZE_X; i++)
    //     {
    //         for (int j = 0; j < OLED_SIZE_Y / 2; j++)
    //         {
    //             oled_write_data(0xff);
    //             oled_write_data(0xff);

    //         }
    //     }
    // #warning debug
    //     while (1)
    //     {
    //         wdt_timer_feed();
    //         // LCD_GC9203_CtrlWrite(0x0029);
    //         // LCD_GC9203_CtrlWrite(0x0011);
    //         LOG("on");
    //         nrf_delay_ms(1000);
    //         wdt_timer_feed();
    //         // LCD_GC9203_CtrlWrite(0x0028);
    //         // LCD_GC9203_CtrlWrite(0x0010);
    //         LOG("off");
    //         nrf_delay_ms(1000);
    //     }
}
